﻿using System;
using System.IO;

namespace mu_chun_util
{
    class MuChunMain
    {
        static void Main(string[] args)
        {

            string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.ini");//在当前程序路径创建

            #region 创建INI文件
            FileStream INIFile = File.Create(filePath);
            INIFile.Close();
            #endregion

            //写入节点1
            INIHelper.Write("s1", "1", "a", filePath);
            INIHelper.Write("s1", "2", "b", filePath);
            INIHelper.Write("s1", "3", "c", filePath);

            //写入节点2
            INIHelper.Write("s2", "4", "d", filePath);
            INIHelper.Write("s2", "5", "e", filePath);

            //改节点value值（就是重写一遍）
            INIHelper.Write("s1", "3", "c3", filePath);

            //读取节点1中的key为1的值
            string value = INIHelper.Read("s1", "1", "", filePath);
            Console.WriteLine(value);

            INIHelper.DeleteKey("s1", "2", filePath);//删除节点s1中key为2的值
            INIHelper.DeleteSection("s2", filePath);//删除节点s2

            Console.WriteLine("Hello World!");
        }
    }
}